<template>
    <div>

        <el-card body-style="padding:10px" class="box-card">
            <h3>违禁词管理</h3>
            <!-- <p style="font-size: 12px;color: #bbbbbb;">发布时间：{{ datas.created_at }}</p> -->

            <el-input type="textarea" :rows="15" placeholder="请输入内容" v-model="datas[0]">
            </el-input>
        </el-card>

        <div class style="width: 200px;margin: 50px auto;"  >
            <el-button @click="submit" style="width: 200px;" type="primary"
              :loading="submitComplete" v-permission="['admin', 'PROHIBITIONS_SAVE']">保 存</el-button>
        </div>

    </div>
</template>
  
<script>
export default {
    name:"prohibitions-words-list",
    data() {
        return {
            datas: [],
            submitComplete:false,
        }
    },
    mounted() {
        this.getSystemNoticeDetails()
    },
    methods: {
        getSystemNoticeDetails(id) {
            let that = this
            this.$request.get('/dirty-word/index').then((res) => {
                that.datas = res
            })
        },

        submit() {
            if(this.submitComplete) return
            this.submitComplete = true
            this.$request.put('/dirty-word/update',{content:this.datas[0]}).then((res) => {
                this.$message({
                    message: '保存成功',
                    type: 'success',
                })
                this.submitComplete = false
            }).catch((error)=>{
                this.submitComplete = false
                });
        },
    }

}
</script>
  
<style lang="scss" scoped></style>